In a distributed data storage system, one server serves as a primary server and another server serves as a dependent server (hereinafter referred to as a secondary server). The primary server can provide an external data read/write service. The secondary server maintains data synchronization with the primary server, and when the primary server fails, the secondary server can provide the external data read/write service.
Usually, when receiving and storing data, the primary server can synchronously store the data in the secondary server, so as to ensure data consistency between the primary server and the secondary server. However, in practice, because there is an operation delay in data synchronization between the primary server and the secondary server, some data in the secondary server may be lost, which cannot ensure data consistency between the secondary server and the primary server.
To ensure data consistency between the primary server and the secondary server, in the existing technology, when the data stored in the primary server is synchronized to the secondary server, the data can be synchronized to a plurality of secondary servers. In other words, a plurality of data copies in the primary server can be stored. When data in one secondary server is lost, the lost data can be obtained from the other secondary servers. As such, when the primary server fails, the plurality of secondary servers can provide an external data read/write service.
However, because the plurality of data copies in the primary server need to be stored, a relatively large number of resources are needed for data storage.